import { combineReducers } from 'redux'


function audioReducer( state = { count: 2 }, action)	{
    //因为在connect函数中会对新旧两个state进行浅对比，如果state只是值改变但是引用地址没有改变，connect会认为它们相同而不触发更新
	switch(action.type){
		case 'AddCount':
			return  { 
                        count: state.count + action.value
                    };
		case 'SubCount':
		    return  {
                        count: state.count - action.value
                    };
		default :
			return state;
	}
}

export default combineReducers({
	audioReducer
})	